home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1998 July / EnigmA AMIGA RUN 29 (1998)(G.R. Edizioni)(IT)[!][issue 1998-07 & 08].iso / earkit / socket / miami3 / miamisdk / netinclude / netdb.h < prev    next >
C/C++ Source or Header  |  1998-05-24  |  3KB  |  91 lines

  1. #ifndef _NETDB_H_
  2. #define _NETDB_H_
  3.  
  4. /*
  5.  * Structures returned by network data base library.  All addresses are
  6.  * supplied in host order, and returned in network order (suitable for
  7.  * use in system calls).
  8.  */
  9. struct    hostent {
  10.     char    *h_name;    /* official name of host */
  11.     char    **h_aliases;    /* alias list */
  12.     long    h_addrtype;    /* host address type */
  13.     long    h_length;    /* length of address */
  14.     char    **h_addr_list;    /* list of addresses from name server */
  15. #define    h_addr    h_addr_list[0]    /* address, for backward compatiblity */
  16. };
  17.  
  18. /*
  19.  * Assumption here is that a network number
  20.  * fits in an unsigned long -- probably a poor one.
  21.  */
  22. struct    netent {
  23.     char        *n_name;    /* official name of net */
  24.     char        **n_aliases;    /* alias list */
  25.     long        n_addrtype;    /* net address type */
  26.     unsigned long    n_net;        /* network # */
  27. };
  28.  
  29. struct    servent {
  30.     char    *s_name;    /* official service name */
  31.     char    **s_aliases;    /* alias list */
  32.     long    s_port;        /* port # */
  33.     char    *s_proto;    /* protocol to use */
  34. };
  35.  
  36. struct    protoent {
  37.     char    *p_name;    /* official protocol name */
  38.     char    **p_aliases;    /* alias list */
  39.     long    p_proto;    /* protocol # */
  40. };
  41.  
  42. /*
  43.  * Error return codes from gethostbyname() and gethostbyaddr()
  44.  */
  45.  
  46. #define    HOST_NOT_FOUND    1 /* Authoritative Answer Host not found */
  47. #define    TRY_AGAIN    2 /* Non-Authoritive Host not found, or SERVERFAIL */
  48. #define    NO_RECOVERY    3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
  49. #define    NO_DATA        4 /* Valid name, no data record of requested type */
  50. #define    NO_ADDRESS    NO_DATA        /* no address, look for MX record */
  51.  
  52. struct addrinfo {
  53.   long        ai_flags;            /* AI_PASSIVE, AI_CANONNAME */
  54.   long        ai_family;            /* PF_xxx */
  55.   long        ai_socktype;        /* SOCK_xxx */
  56.   long        ai_protocol;        /* IPPROTO_xxx for IPv4 and IPv6 */
  57.   size_t    ai_addrlen;            /* length of ai_addr */
  58.   char        *ai_canonname;        /* canonical name for host */
  59.   struct sockaddr    *ai_addr;    /* binary address */
  60.   struct addrinfo    *ai_next;    /* next structure in linked list */
  61. };
  62.  
  63.             /* following for getaddrinfo() */
  64. #define    AI_PASSIVE         1    /* socket is intended for bind() + listen() */
  65. #define    AI_CANONNAME     2    /* return canonical name */
  66.  
  67.             /* following for getnameinfo() */
  68. #define    NI_MAXHOST      1025    /* max hostname returned */
  69. #define    NI_MAXSERV        32    /* max service name returned */
  70.  
  71. #define    NI_NOFQDN         1    /* do not return FQDN */
  72. #define    NI_NUMERICHOST   2    /* return numeric form of hostname */
  73. #define    NI_NAMEREQD         4    /* return error if hostname not found */
  74. #define    NI_NUMERICSERV   8    /* return numeric form of service name */
  75. #define    NI_DGRAM        16    /* datagram service for getservbyname() */
  76.  
  77.             /* error returns */
  78. #define    EAI_ADDRFAMILY     1    /* address family for host not supported */
  79. #define    EAI_AGAIN         2    /* temporary failure in name resolution */
  80. #define    EAI_BADFLAGS     3    /* invalid value for ai_flags */
  81. #define    EAI_FAIL         4    /* non-recoverable failure in name resolution */
  82. #define    EAI_FAMILY         5    /* ai_family not supported */
  83. #define    EAI_MEMORY         6    /* memory allocation failure */
  84. #define    EAI_NODATA         7    /* no address associated with host */
  85. #define    EAI_NONAME         8    /* host nor service provided, or not known */
  86. #define    EAI_SERVICE         9    /* service not supported for ai_socktype */
  87. #define    EAI_SOCKTYPE    10    /* ai_socktype not supported */
  88. #define    EAI_SYSTEM        11    /* system error returned in errno */
  89.  
  90. #endif /* !_NETDB_H_ */
  91.